//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package 力扣.题库.未分类.demo40AND60;

public class demo_50 {
    public demo_50() {
    }

    public static void main(String[] args) {
        System.out.println(myPow((double)2.0F, Integer.MIN_VALUE));
    }

    public static double myPow(double x, int n) {
        if (n == 0) {
            return (double)1.0F;
        } else if (x == (double)1.0F) {
            return (double)1.0F;
        } else {
            double out = (double)1.0F;
            long pingfang = (long)n;
            boolean negative = false;
            if (pingfang < 0L) {
                negative = true;
                pingfang = -pingfang;
            }

            while(pingfang != 1L) {
                if (pingfang % 2L == 0L) {
                    x *= x;
                    pingfang /= 2L;
                } else {
                    out *= x;
                    x *= x;
                    pingfang /= 2L;
                }
            }

            if (negative) {
                return (double)1.0F / (out * x);
            } else {
                return out * x;
            }
        }
    }
}
